﻿<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>选择了哪一个单选框</title>
    <script type="text/javascript">
        function checkradio(){
            var parms = document.getElementsByName("radio1");
            var i;
            for(i = 0;i < parms.length;i++){
                if(parms[i].checked){
                    alert("你选择了" + parms[i].value);
                }
            }
        }
    </script>
</head>
<body>
<input name="radio1" type="radio" value="体育运动" checked="checked"/>体育运动
<input name="radio1" type="radio" value="旅游休闲"/>旅游休闲
<input type="button" name="btn1" value="检查" onclick="checkradio()"/>
</body>
</html>